package com.cuit.qx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cuit.qx.bean.Threshold;
import com.cuit.qx.bean.WarnSound;
import com.cuit.qx.dao.WarnSoundMapper;
import com.cuit.qx.service.WarnSoundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @Title: Controller
 * @Description:
 * @Author: wk
 * @Date; 2021/2/2
 * @Version: V1.0
 */
@Service
public class WarnSoundServiceImpl extends ServiceImpl<WarnSoundMapper, WarnSound> implements WarnSoundService {

    @Autowired
    private WarnSoundMapper warnSoundMapper;

    @Override
    public IPage<WarnSound> getWarnSoundList(Integer pageNo, Integer pageSize) {
        IPage<WarnSound> page = new Page<>(pageNo, pageSize);//参数一是当前页，参数二是每页个数
        QueryWrapper<WarnSound> query = new QueryWrapper<>();
        IPage<WarnSound> warnSoundIPage = warnSoundMapper.selectPage(page, query);
        return warnSoundIPage;
    }

    @Override
    public int insertWarnSound(WarnSound warnSound) {
        int num = warnSoundMapper.insert(warnSound);
        return num;
    }

    @Override
    public int updateWarnSound(WarnSound warnSound) {
        int num = warnSoundMapper.updateById(warnSound);
        return num;
    }

    @Override
    public int updateWarnSoundStatus(String id) {
        int num = warnSoundMapper.updateWarnSoundStatusById(id);
        return num;
    }

    @Override
    public void updateWarnSoundOtherStatus(String warnSoundOtherId) {
        warnSoundMapper.updateWarnSoundOtherStatusById(warnSoundOtherId);
    }
}
